# -*- coding: utf-8 -*-

# Define your item pipelines here
#
# Don't forget to add your pipeline to the ITEM_PIPELINES setting
# See: https://doc.scrapy.org/en/latest/topics/item-pipeline.html
import requests

class DoutuPipeline(object):
    def process_item(self, item, spider):
        url = 'http://mm.yh31.com:88'+item['addr']
        response = requests.get(url)
        response.encoding = 'utf-8'
        with open('E:\\python\\tcl\\回顾python\\scrapy\\data\\%d.gif'%item['name'],'wb') as ft:
            ft.write(response.content)   #要的是二进制数据
